<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    //
    protected $table = 'order';

    protected $guarded = ['process'];

    protected $hidden = ['xml'];

//    public function getPayStatusAttribute($value)
//    {
//        $statusMap = [
//            0 => '待支付',
//            1 => '已支付',
//        ];
//
//        return $statusMap[$value] ?? '未知状态';
//    }
//
//
//    public function getOrderStatusAttribute($value)
//    {
//        $statusMap = [
//            0 => '待核销',
//            1 => '部分核销',
//            2 => '已完成',
//        ];
//
//        return $statusMap[$value] ?? '未知状态';
//    }


    public function user(){

        return $this->hasOne(User::class,'id','user_id');
    }



    public function order_user(){

        return $this->hasMany(OrderUser::class,'order_id','id');

    }

    //活动
    public function activity(){

        return $this->hasOne(Activity::class,'id','activity_id');
    }



}
